// Metgine/Graphics/Sprite.h
//
// Copyright 2011 Phillip Stephens
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library.  Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.

#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Color.hpp>
#include <Metgine/Config.h>
#include <Metgine/Graphics/Renderable.h>
#include <Metgine/Core/Math.h>
#include <Metgine/Core/Vector2.h>
#include <Metgine/Core/ImageResource.h>

using namespace Metgine::Core;

namespace Metgine
{
namespace Graphics
{

class METGINE_API Sprite : public Renderable
{
public:
    Sprite();
    Sprite(Core::ImageResource* res, sf::Color color = sf::Color(255, 255, 255));
    ~Sprite();

    const sf::Drawable& GetData() const;


    void SetPosition(Vector2f& newPosition);
    void SetColor(sf::Color newColor);
    void SetImage(Core::ImageResource* resource);
    void SetCenter(float x, float y);
    void Center();
    void SetPosition(float x, float y);
    void SetRotation(float degrees);
    void SetOrientation(const Vector2f& direction);
    void SetScale(float x, float y);
    Vector2f GetPosition() const;
    Vector2f GetSize() const;
    Vector2f GetScale() const;
    void Move(float x, float y);
    void SetAlphaBlend(bool state);
    float GetWidth() const;
    float GetHeight() const;
    void SetMirrored(bool state);

    // Sets the width of the sprite
    void SetWidth(float width);
private:
    sf::Sprite         m_data;
    sf::Color          m_color;
};

}; // Graphics
}; // Metgine

#endif // __SPRITE_H__
